﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _01.School
{
    public class Theacher : Person, IComment
    {
        private readonly List<Discipline> theachedDisciplines = new List<Discipline>();

        public Theacher(string firstName, string secondName, List<Discipline> disciplinesList, string comment = null)
            : base(firstName, secondName)
        {
            for (int index = 0; index < disciplinesList.Count; index++)
            {
                theachedDisciplines.Add(disciplinesList[index]);
            }

            if (comment != null)
            {
                this.CommentList.Add(comment);
            }
        }

        

        public List<string> CommentList
        {
            get 
            {
                return CommentList;
            }
            set
            {
                CommentList = value;
            }
        }

        public List<Discipline> TheachedDisciplines
        {
            get
            {
                return this.theachedDisciplines;
            }           
        }

        public void AddComment(string text)
        {
            CommentList.Add(text);
        }

        public override string ToString()
        {
            StringBuilder result = new StringBuilder();
            for (int index = 0; index < theachedDisciplines.Count; index++)
			{
                result.AppendLine(theachedDisciplines[index].ToString());
			}

            return result.ToString();
        }
    }
}
